import sqlalchemy as sa
from sqlalchemy import orm

from cibynet.model import meta
from cibynet.model import tables
from cibynet.model import mapping

def init_model(engine):
  """To call before using any of the tables or classes in the model."""
  sm = orm.sessionmaker(autoflush=True, autocommit=False, bind=engine)
  meta.engine = engine
  meta.Session = orm.scoped_session(sm)
